/************************************************/
/************************************************/
/*** PART 4.6: FIGURE 2 ***/
/************************************************/
/************************************************/

****************************
*** POTENTIAL MECHANISMS
*******************************

	reg bnode_in_fav biat_ethnic $covar1a maleshare i.b_schoolid i.grade1 if refugee==0 & sample1==1, cluster(b_classid)
	estimates store spec4a

	reg bnode_in_fav biat_ethnic $covar1a maleshare i.b_schoolid i.grade1 if refugee==1 & sample1==1, cluster(b_classid)
	estimates store spec4b

	reg fethnicbias_sd biat_ethnic $covar1a teacherseat i.grade1 i.b_schoolid if refugee==0 & empathy_treatment~=1 & sample1==1, cluster(b_classid)
	estimates store spec5a

	reg fethnicbias_sd biat_ethnic $covar1a teacherseat i.grade1 i.b_schoolid if refugee==1 & empathy_treatment~=1 & sample1==1, cluster(b_classid) 
	estimates store spec5b

	reg backdesk biat_ethnic male $covar1a teacherseat i.grade1 i.b_schoolid if refugee==0 & sample1==1, cluster(b_classid)
	estimates store spec6a

	xi: reg backdesk biat_ethnic $covar1a teacherseat i.grade1 i.b_schoolid if refugee==1 & sample1==1, cluster(b_classid)
	estimates store spec6b

	** COEFFICIENT PLOTS

	#delimit ;
	coefplot (spec5a, keep(biat_ethnic)) 
	(spec4a, keep(biat_ethnic)) 
	(spec6a, keep(biat_ethnic))

	|| 
	(spec5b, keep(biat_ethnic))
	(spec4b, keep(biat_ethnic)) 
	(spec6b, keep(biat_ethnic))

	||
	,  horizontal  xline(0) xscale(range (-0.5 0.5)) mlabel(cond(@pval<.01, string(@b,"%9.2f") + "***", cond(@pval<.05, string(@b,"%9.2f") + "**", cond(@pval<.1, string(@b,"%9.2f") + "*", string(@b,"%9.2f"))))) format(%8.2f)  mlabposition(12) mlabgap(*2) mlabcolor(gs2) ciopts(recast(rcap) color(gs10))  color(gs2) citop color(gs6)
	xtitle(Point Estimates with 95% CIs, margin(0 -40 0 0))  
	byopts(legend(off)
	graphregion(color(white))) bgcolor(white)
	xline(0, lcolor(black))
	ylabel(0.75 "Student Ethnic Bias" 1.00 "Teacher's Favorites"  1.25 "Seated at Back" )
	bylabels("Host" "Refugee")
	subtitle(,color(white) bcolor(gs4))
	;
	#delimit cr
	graph export "$path1/figure2.png", replace

